import { ElNotification } from "element-plus";
import { $del, $post ,$put,$get } from "../utils/requst";

//产品列表
export const $ProductManageList = async (params:object)=>{
    let ret = await $get('/system/productManage/list',params)
    console.log(ret)
    if(ret.code == 0){
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//产品新增
export const $ProductManageAdd = async (params:object)=>{
    let ret = await $post('/system/productManage/add',params)
    console.log(ret)
    if(ret.code == 0){
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'success'
        })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//产品编辑
export const $ProductManageEdit = async (params:object)=>{
    console.log('params',params)
    let ret = await $put('/system/productManage/edit',params)
    console.log(ret)
    if(ret.code == 0){
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'success'
        })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//产品删除
export const $ProductManageDel = async (params:object)=>{
    console.log('params',params)
    let ret = await $del('/system/productManage/remove',{params})
    console.log(ret)
    if(ret.code == 0){
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'success'
        })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//服务列表
export const $ServiceManageList = async (params:object)=>{
    let ret = await $get('/system/serviceManage/list',params)
    console.log(ret)
    if(ret.code == 0){
        // ElNotification({
        //     title:'通知',
        //     message: ret.message,
        //     type:'success'
        // })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//服务新增
export const $ServiceManageAdd = async (params:object)=>{
    let ret = await $post('/system/serviceManage/add',params)
    console.log(ret)
    if(ret.code == 0){
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'success'
        })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//服务编辑
export const $ServiceManageEdit = async (params:object)=>{
    console.log('params',params)
    let ret = await $put('/system/serviceManage/edit',params)
    console.log(ret)
    if(ret.code == 0){
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'success'
        })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//服务删除
export const $ServiceManageDel = async (params:object)=>{
    console.log('params',params)
    let ret = await $del('/system/serviceManage/remove',{params})
    console.log(ret)
    if(ret.code == 0){
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'success'
        })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//案例列表
export const $CaseManageList = async (params:object)=>{
    let ret = await $get('/system/caseManage/list',params)
    console.log(ret)
    if(ret.code == 0){
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//案例新增
export const $CaseManageAdd = async (params:object)=>{
    let ret = await $post('/system/caseManage/add',params)
    console.log(ret)
    if(ret.code == 0){
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'success'
        })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//案例编辑
export const $CaseManageEdit = async (params:object)=>{
    console.log('params',params)
    let ret = await $put('/system/caseManage/edit',params)
    console.log(ret)
    if(ret.code == 0){
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'success'
        })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//案例删除
export const $CaseManageDel = async (params:object)=>{
    console.log('params',params)
    let ret = await $del('/system/caseManage/remove',{params})
    console.log(ret)
    if(ret.code == 0){
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'success'
        })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//案例列表
export const $NewsManageList = async (params:object)=>{
    let ret = await $get('/system/newsManage/list',params)
    console.log(ret)
    if(ret.code == 0){
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//案例新增
export const $NewsManageAdd = async (params:object)=>{
    let ret = await $post('/system/newsManage/add',params)
    console.log(ret)
    if(ret.code == 0){
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'success'
        })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//案例编辑
export const $NewsManageEdit = async (params:object)=>{
    console.log('params',params)
    let ret = await $put('/system/newsManage/edit',params)
    console.log(ret)
    if(ret.code == 0){
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'success'
        })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//案例删除
export const $NewsManageDel = async (params:object)=>{
    console.log('params',params)
    let ret = await $del('/system/newsManage/remove',{params})
    console.log(ret)
    if(ret.code == 0){
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'success'
        })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}


//评价列表
export const $EvaluateList = async (params:object)=>{
    let ret = await $get('/system/evaluate/list',params)
    console.log(ret)
    if(ret.code == 0){
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//评价新增
export const $EvaluateAdd = async (params:object)=>{
    let ret = await $post('/system/evaluate/add',params)
    console.log(ret)
    if(ret.code == 0){
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'success'
        })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//评价编辑
export const $EvaluateEdit = async (params:object)=>{
    console.log('params',params)
    let ret = await $put('/system/evaluate/edit',params)
    console.log(ret)
    if(ret.code == 0){
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'success'
        })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//评价删除
export const $EvaluateDel = async (params:object)=>{
    console.log('params',params)
    let ret = await $del('/system/evaluate/remove',{params})
    console.log(ret)
    if(ret.code == 0){
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'success'
        })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}


//导航栏列表
export const $NavigationList = async (params:object)=>{
    let ret = await $get('/system/navigation/list',params)
    console.log(ret)
    if(ret.code == 0){
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//导航栏新增
export const $NavigationAdd = async (params:object)=>{
    let ret = await $post('/system/navigation/add',params)
    console.log(ret)
    if(ret.code == 0){
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'success'
        })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//导航栏编辑
export const $NavigationEdit = async (params:object)=>{
    console.log('params',params)
    let ret = await $put('/system/navigation/edit',params)
    console.log(ret)
    if(ret.code == 0){
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'success'
        })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//导航栏删除
export const $NavigationDel = async (params:object)=>{
    console.log('params',params)
    let ret = await $del('/system/navigation/remove',{params})
    console.log(ret)
    if(ret.code == 0){
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'success'
        })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}
